﻿<UserControl x:Class="Rifts.Controls.FightingStyle"
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
			 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
			 xmlns:l="clr-namespace:Rifts.Controls"
			 mc:Ignorable="d" 
			 d:DesignHeight="400" d:DesignWidth="768">
	<Grid >
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="304" />
			<ColumnDefinition Width="*" />
		</Grid.ColumnDefinitions>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
		</Grid.RowDefinitions>

		<StackPanel Grid.Column="0">

			<l:GroupPanel Header="Style" HeaderFontSize="14" Padding="4">
				<Grid l:LabeledTextBlock.TextWidth="40" l:LabeledTextBlock.HeaderWidth="90" >
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="Auto" />
						<ColumnDefinition Width="*" />
					</Grid.ColumnDefinitions>
					<Grid.RowDefinitions>
						<RowDefinition Height="Auto"/>
						<RowDefinition Height="Auto"/>
					</Grid.RowDefinitions>


					<Grid Grid.Row="0" Grid.ColumnSpan="2" HorizontalAlignment="Center">
						<l:LabeledTextBlock Header="Style" Text="{Binding Name}" HeaderWidth="NaN" TextWidth="150"  />
					</Grid>
					<StackPanel Grid.Column="0" Grid.Row="1">
						<l:LabeledTextBlock Header="Attacks" Text="{Binding Attacks}" />
						<l:LabeledTextBlock Header="Actions" Text="{Binding Actions}" Visibility="{Binding Actions, Converter={StaticResource NotZeroToVisibleConverter}}" />
						<l:LabeledTextBlock Header="Initiative" Text="{Binding Initiative, StringFormat={StaticResource BonusFormat}}" />
						<TextBlock Text="Strike Ranged"/>
						<l:LabeledTextBlock Margin="4,0,0,0" Header="Ranged [8]" Text="{Binding RangedStrike, StringFormat={StaticResource BonusFormat}}" />
						<l:LabeledTextBlock Margin="4,0,0,0" Header="Melee [4]" Text="{Binding MeleeStrike, StringFormat={StaticResource BonusFormat}}" />

						<l:LabeledTextBlock Header="Damage" Text="{Binding DamageFromPS, StringFormat={StaticResource BonusFormat}}" Visibility="{Binding DamageFromPS, Converter={StaticResource NotZeroToVisibleConverter}}"/>
						<l:LabeledTextBlock Header="Disarm Bonus" Text="{Binding Disarm, StringFormat={StaticResource BonusFormat}}" Visibility="{Binding Disarm, Converter={StaticResource NotZeroToVisibleConverter}}"/>
						<l:LabeledTextBlock Header="Entangle" Text="{Binding Entangle, StringFormat={StaticResource BonusFormat}}" Visibility="{Binding Entangle, Converter={StaticResource NotZeroToVisibleConverter}}"/>
						<l:LabeledTextBlock Header="Flip/Throw" Text="{Binding FlipThrow, StringFormat={StaticResource BonusFormat}}" Visibility="{Binding FlipThrow, Converter={StaticResource NotZeroToVisibleConverter}}"/>
					</StackPanel>
					<StackPanel Grid.Column="1" Grid.Row="1">
						<l:LabeledTextBlock Header="Dodge: Melee" Text="{Binding MeleeDodge, StringFormat={StaticResource BonusFormat}}"  />
						<l:LabeledTextBlock Header="Dodge: Ranged" Text="{Binding RangedDodge, StringFormat={StaticResource BonusFormat}}"  />
						<l:LabeledTextBlock Header="Dodge: Auto" Text="{Binding AutoDodge, StringFormat={StaticResource BonusFormat}}" Visibility="{Binding AutoDodge, Converter={StaticResource NotNullToVisibleConverter}}"  />
						<l:LabeledTextBlock Header="Roll w/Impact" Text="{Binding Roll, StringFormat={StaticResource BonusFormat}}"   />
						<l:LabeledTextBlock Header="Pull Punch [11]" Text="{Binding PullPunch, StringFormat={StaticResource BonusFormat}}"  />
					</StackPanel>




				</Grid>
			</l:GroupPanel>

			<l:GroupPanel Header="Abilities" Padding="4">
				<ItemsControl ItemsSource="{Binding Abilities}">
					<ItemsControl.ItemTemplate>
						<DataTemplate>
							<StackPanel>
								<Grid >
									<Grid.ColumnDefinitions>
										<ColumnDefinition Width="*"/>
										<ColumnDefinition Width="10"/>
										<ColumnDefinition Width="25"/>
									</Grid.ColumnDefinitions>
									<Viewbox StretchDirection="DownOnly" HorizontalAlignment="Left" Grid.Column="0">
										<TextBlock Text="{Binding Name}"/>
									</Viewbox>
									<l:CalculatedTextBlock Text="{Binding Score, StringFormat={} {0}%}" Visibility="{Binding Score, Converter={StaticResource NotNullToVisibleConverter}}" Grid.Column="2"/>
								</Grid>
								<TextBlock Text="{Binding BookReference}" Visibility="{Binding BookReference, Converter={StaticResource NotZeroToVisibleConverter}}"  FontStyle="Italic" />
							</StackPanel>
						</DataTemplate>
					</ItemsControl.ItemTemplate>
				</ItemsControl>
			</l:GroupPanel>

		</StackPanel>

		<StackPanel Grid.Column="1">

			<l:GroupPanel Header="Unarmed Attacks" Padding="4">
				<StackPanel>
					<Grid >
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="140"/>
							<ColumnDefinition Width="50"/>
							<ColumnDefinition Width="75"/>
							<ColumnDefinition Width="75"/>
							<ColumnDefinition Width="75"/>
						</Grid.ColumnDefinitions>
						<TextBlock Grid.Column="0" Text="Attack" />
						<TextBlock Grid.Column="1" Text="Strike" HorizontalAlignment="Center"/>
						<TextBlock Grid.Column="2" Text="Restrained" HorizontalAlignment="Center" />
						<TextBlock Grid.Column="3" Text="Normal" HorizontalAlignment="Center"/>
						<TextBlock Grid.Column="4" Text="Power" HorizontalAlignment="Center"/>
					</Grid>
					<ItemsControl ItemsSource="{Binding UnarmedAttacks}">
						<ItemsControl.ItemTemplate>
							<DataTemplate>
								<StackPanel>
									<Grid >
										<Grid.ColumnDefinitions>
											<ColumnDefinition Width="140"/>
											<ColumnDefinition Width="50"/>
											<ColumnDefinition Width="75"/>
											<ColumnDefinition Width="75"/>
											<ColumnDefinition Width="75"/>
										</Grid.ColumnDefinitions>
										<TextBlock Text="{Binding Name}" Width="140" Grid.Column="0" />
										<l:CalculatedTextBlock Text="{Binding Strike, StringFormat={StaticResource BonusFormat}}" Visibility="{Binding Strike, Converter={StaticResource NotNullToVisibleConverter}}" Width="25" Grid.Column="1"/>
										<l:CalculatedTextBlock Text="{Binding RestrainedDamage}" Visibility="{Binding RestrainedDamage, Converter={StaticResource NotZeroToVisibleConverter}}" Width="60" Grid.Column="2"/>
										<l:CalculatedTextBlock Text="{Binding NormalDamage}" Visibility="{Binding NormalDamage, Converter={StaticResource NotZeroToVisibleConverter}}" Width="60" Grid.Column="3"/>
										<l:CalculatedTextBlock Text="{Binding PowerDamage}" Visibility="{Binding PowerDamage, Converter={StaticResource NotZeroToVisibleConverter}}" Width="60" Grid.Column="4"/>
									</Grid>
									<StackPanel Orientation="Horizontal" Margin="10,0,0,0">
										<l:LabeledTextBlock Header="Range" Text="{Binding Range}" Visibility="{Binding Range, Converter={StaticResource NotZeroToVisibleConverter}}" Width="175"/>
										<l:LabeledTextBlock Header="Ammo" Text="{Binding Ammo}" Visibility="{Binding Ammo, Converter={StaticResource NotZeroToVisibleConverter}}" Width="175"/>
									</StackPanel>
									<l:LabeledTextBlock Header="Notes" Margin="10,0,0,0" Text="{Binding Notes}" Visibility="{Binding Notes, Converter={StaticResource NotZeroToVisibleConverter}}" Width="375"/>
								</StackPanel>
							</DataTemplate>
						</ItemsControl.ItemTemplate>
					</ItemsControl>
				</StackPanel>
			</l:GroupPanel>

			<l:GroupPanel Header="Weapons Proficiencies">
				<StackPanel>
					<Grid>
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="*"/>
							<ColumnDefinition Width="50"/>
							<ColumnDefinition Width="50"/>
							<ColumnDefinition Width="50"/>
							<ColumnDefinition Width="50"/>
							<ColumnDefinition Width="50"/>
							<ColumnDefinition Width="50"/>
						</Grid.ColumnDefinitions>
						<Grid.RowDefinitions>
							<RowDefinition Height="Auto"/>
						</Grid.RowDefinitions>
						
						<!--<TextBlock Grid.Column="0" Grid.Row="1" Text="Attack" />-->
						<TextBlock Grid.Column="1" Text="Melee" HorizontalAlignment="Center"/>
						<TextBlock Grid.Column="2" Text="Ranged" HorizontalAlignment="Center"/>
						<TextBlock Grid.Column="3" Text="Parry" HorizontalAlignment="Center"/>
						<TextBlock Grid.Column="4" Text="Entangle" HorizontalAlignment="Center"/>
						<TextBlock Grid.Column="5" Text="Disarm" HorizontalAlignment="Center"/>
						<TextBlock Grid.Column="6" Text="Damage" HorizontalAlignment="Center"/>
						
					</Grid>
					<ItemsControl ItemsSource="{Binding Proficiencies}">
						<ItemsControl.ItemTemplate>
							<DataTemplate>
								<StackPanel>
									<Grid >
										<Grid.ColumnDefinitions>
											<ColumnDefinition Width="*"/>
											<ColumnDefinition Width="50"/>
											<ColumnDefinition Width="50"/>
											<ColumnDefinition Width="50"/>
											<ColumnDefinition Width="50"/>
											<ColumnDefinition Width="50"/>
											<ColumnDefinition Width="50"/>
										</Grid.ColumnDefinitions>
										<TextBlock Text="{Binding Name}" Grid.Column="0" />

										<l:CalculatedTextBlock Text="{Binding MeleeStrike, StringFormat={StaticResource BonusFormat}}" Visibility="{Binding MeleeStrike, Converter={StaticResource NotZeroToVisibleConverter}}" Width="25" Grid.Column="1"/>
										
										<l:CalculatedTextBlock Text="{Binding ThrownStrike, StringFormat={StaticResource BonusFormat}}" Visibility="{Binding ThrownStrike, Converter={StaticResource NotZeroToVisibleConverter}}" Width="25" Grid.Column="2"/>
										
										<l:CalculatedTextBlock Text="{Binding RangedStrike, StringFormat={StaticResource BonusFormat}}" Visibility="{Binding RangedStrike, Converter={StaticResource NotZeroToVisibleConverter}}" Width="25" Grid.Column="2"/>


										<l:CalculatedTextBlock Text="{Binding Parry, StringFormat={StaticResource BonusFormat}}" Visibility="{Binding Parry, Converter={StaticResource NotZeroToVisibleConverter}}" Width="25" Grid.Column="3"/>

										<l:CalculatedTextBlock Text="{Binding Entangle, StringFormat={StaticResource BonusFormat}}" Visibility="{Binding Entangle, Converter={StaticResource NotZeroToVisibleConverter}}" Width="25" Grid.Column="4"/>

										<l:CalculatedTextBlock Text="{Binding Disarm, StringFormat={StaticResource BonusFormat}}" Visibility="{Binding Disarm, Converter={StaticResource NotZeroToVisibleConverter}}" Width="25" Grid.Column="5"/>

										<l:CalculatedTextBlock Text="{Binding Damage, StringFormat={StaticResource BonusFormat}}" Visibility="{Binding Damage, Converter={StaticResource NotZeroToVisibleConverter}}" Width="25" Grid.Column="6"/>
									</Grid>
									
									<!--<l:LabeledTextBlock Header="Notes" Margin="10,0,0,0" Text="{Binding Notes}" Visibility="{Binding Notes, Converter={StaticResource NotZeroToVisibleConverter}}" Width="375"/>-->
								</StackPanel>
							</DataTemplate>
						</ItemsControl.ItemTemplate>
					</ItemsControl>
				</StackPanel>
			</l:GroupPanel>

		</StackPanel>



	</Grid>

</UserControl>
